Skip to content

fix(web): scroll terminal output with touch gestures - #11305

Open
shivamhwp wants to merge 1 commit into
mainfrom
fix/web-terminal-touch-scroll
Open

fix(web): scroll terminal output with touch gestures#11305
shivamhwp wants to merge 1 commit into
mainfrom
fix/web-terminal-touch-scroll

Conversation

@shivamhwp

@shivamhwp shivamhwp commented Sep 11, 2026

Copy link
Copy Markdown
Collaborator

Closes #2141

Touch drags in the web terminal selected text instead of scrolling, leaving mobile browsers stuck at the newest output in #2141.

Route vertical touch drags through the terminal's existing wheel behavior. Scrollback moves in both directions, full-screen programs receive their existing scroll input, and taps still focus the terminal or open links. Pointer activation also selects the touched split pane.

59 focused terminal tests and web typecheck pass. Four new touch cases fail on the baseline; scoped lint reports seven existing drawer warnings. In the isolated Chromium client, the same gesture changes scrollback from 87 to 77 and back to 87 after the fix; it stays at 87 before. Tapping an inactive split selects and focuses it. Physical iOS/Android browsers, native mobile, and remote/relay sessions were not exercised. Web and desktop share this terminal; native mobile uses a separate client. There are no provider, wire-contract, or settings changes.

Rebased onto main, which includes the device-ticket correction from #11304.

Before:

Before: touch drag leaves terminal at the newest output

After:

After: touch drag reveals earlier output

Touch scrolling in both directions:

t3-2141-touch-scroll.mp4

Model: GPT-6. Harness: Codex in T3 Code.

Rebased on main 20363c32c9bfdbf49c2716ef11d1f18483fcc01b. Scoped validation rerun after rebasing; existing native and human review limits remain.

Summary by CodeRabbit

  • New Features

    • Added touch drag scrolling to the terminal.
    • Preserved touch interactions for alternate-screen applications and mouse-tracking applications.
    • Added touch support for activating links with taps while preventing activation during drags or canceled gestures.
    • Improved terminal pane activation for pointer-based interactions.
  • Bug Fixes

    • Prevented secondary touches from interfering with an active touch gesture.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Sep 11, 2026
@macroscopeapp

macroscopeapp Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at f23f7ba

Macroscope's review found this PR approvable — This is a localized terminal interaction fix that adds touch scrolling while reusing existing wheel, alternate-screen, mouse-tracking, and link behavior. The focused tests cover the new gesture states, and no production configuration, schema, security, billing, or static-analysis settings are changed.

Notes:

  • Diff unchanged. Approvability was decided on eligibility alone.

No code changes detected at f93204e. Prior analysis still applies.

You can add or adjust custom eligibility rules. Learn more.

@github-actions

github-actions Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.5 KiB 13.6 KiB +71 B (+0.5%) 15.1 KiB
Codex Thread snapshot wire 7.0 KiB 7.0 KiB −1 B (−0.0%) 7.3 KiB
Codex Live turn WebSocket wire 6.5 KiB 6.6 KiB +72 B (+1.1%) 7.8 KiB
Codex Live turn WebSocket decoded 57.0 KiB 57.1 KiB +88 B (+0.2%) 66.4 KiB
Codex Live turn messages 8 10 +2 (+25.0%) 21
Claude Total thread wire 13.6 KiB 13.6 KiB −34 B (−0.2%) 15.1 KiB
Claude Thread snapshot wire 7.1 KiB 7.1 KiB −3 B (−0.0%) 7.3 KiB
Claude Live turn WebSocket wire 6.6 KiB 6.5 KiB −31 B (−0.5%) 7.8 KiB
Claude Live turn WebSocket decoded 57.9 KiB 57.8 KiB −44 B (−0.1%) 66.4 KiB
Claude Live turn messages 10 9 −1 (−10.0%) 21

Baseline: e628683 · PR result: f93204e · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@shivamhwp
shivamhwp force-pushed the fix/web-terminal-touch-scroll branch from d62b7a1 to f23f7ba Compare September 13, 2026 15:36
@shivamhwp
shivamhwp changed the base branch from fix/client-device-ticket-http-group to main September 13, 2026 15:36
@github-actions github-actions Bot added the 📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. label Sep 13, 2026
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: aee2047a-1158-4f05-be00-f936fed16572

📥 Commits

Reviewing files that changed from the base of the PR and between 20363c3 and f23f7ba.

📒 Files selected for processing (3)
  • apps/web/src/components/ThreadTerminalDrawer.tsx
  • apps/web/src/terminal/ghostty/surface.test.ts
  • apps/web/src/terminal/ghostty/surface.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


📝 Walkthrough

Walkthrough

The terminal surface now supports touch drag scrolling and touch-aware link and mouse-reporting behavior. Wheel and touch scrolling share one dispatch path. Terminal panes activate on pointer-down. Tests cover touch gestures and cancellation.

Changes

Terminal touch support

Layer / File(s) Summary
Touch gesture lifecycle
apps/web/src/terminal/ghostty/surface.ts
The surface tracks the primary touch pointer, captures events, converts vertical movement into scroll rows, and handles taps, drags, cancellation, and additional fingers.
Shared touch and wheel scrolling
apps/web/src/terminal/ghostty/surface.ts
Wheel and touch scrolling use scrollRows, which handles mouse reporting, alternate-screen arrow sequences, and viewport scrolling.
Pointer activation and touch validation
apps/web/src/components/ThreadTerminalDrawer.tsx, apps/web/src/terminal/ghostty/surface.test.ts
Terminal pane activation uses onPointerDown. Tests cover touch scrolling, alternate-screen input, mouse reporting, link activation, cancellation, and multi-touch behavior.

Priority: ⬆️ High

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix · Severity of issue fixed: High

Sequence Diagram(s)

sequenceDiagram
  participant TouchPointer
  participant GhosttySurface
  participant TerminalState
  TouchPointer->>GhosttySurface: pointerdown
  GhosttySurface->>GhosttySurface: capture primary touch
  TouchPointer->>GhosttySurface: pointermove
  GhosttySurface->>TerminalState: scrollRows
  TouchPointer->>GhosttySurface: pointerup
  GhosttySurface->>TerminalState: activate link or report mouse event
Loading

Suggested reviewers: stienswout

Merge Risk: ⚪ Minimal · up to f9320

Touch scrolling preserves gesture ownership and the reviewed behavior is ready to merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 2 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Issue #2141 requires touch scrolling through terminal output on mobile web. surface.ts tracks primary touch drags, converts vertical movement into terminal row scrolling, and reuses the existing whe…
Out of Scope Changes check ✅ Passed The changes are limited to terminal touch handling, terminal surface tests, and split-pane pointer activation. These changes support touch scrolling and touch interaction for issue #2141. No unrelated…
Title check ✅ Passed The title clearly and concisely describes the main change: adding touch-gesture scrolling for terminal output.
Description check ✅ Passed The description explains what changed and why, includes validation results and limitations, and provides screenshots and a video for the interaction change. It does not use the template headings or ch…
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/web-terminal-touch-scroll

Comment @coderabbitai help to get the list of available commands.

@shivamhwp
shivamhwp force-pushed the fix/web-terminal-touch-scroll branch from f23f7ba to f93204e Compare September 13, 2026 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📱 Native Change Changes the native fingerprint; merging blocks production OTAs until a new store build ships. size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Cant scroll terminal in mobile web

1 participant